<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="utf-8"/>
    <title>用户管理</title>
    <!-- 最新版本的 Bootstrap 核心 CSS 文件 -->
    <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bootstrap@3.3.7/dist/css/bootstrap.min.css" integrity="sha384-BVYiiSIFeK1dGmJRAkycuHAHRg32OmUcww7on3RYdg4Va+PmSTsz/K68vbdEjh4u" crossorigin="anonymous">

    <!-- 可选的 Bootstrap 主题文件（一般不用引入） -->
    <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bootstrap@3.3.7/dist/css/bootstrap-theme.min.css" integrity="sha384-rHyoN1iRsVXV4nD0JutlnGaslCJuC7uwjduW9SVrLvRYooPp2bWYgmgJQIXwl/Sp" crossorigin="anonymous">

    <!-- 最新的 Bootstrap 核心 JavaScript 文件 -->
    <script src="https://cdn.jsdelivr.net/npm/bootstrap@3.3.7/dist/js/bootstrap.min.js" integrity="sha384-Tc5IQib027qvyjSMfHjOMaLkfuWVxZxUPnCJA7l2mCWNIpG9mGCD8wGNIcPD7Txa" crossorigin="anonymous"></script>
</head>
<meta name="author" content="DeathGhost" />
<style>
    table{top: 150px}
</style>
<body>
<table class="table table-hover" id="tab">
    <tr>
        <td>ID</td>
        <td>用户名</td>
        <td>删除用户</td>
        <td>修改用户</td>
    </tr>
</table>
</body>
</html>
<script src="__PUBLIC__/admin/js/jquery.js"></script>
<script type="text/javascript">
    $(document).ready(function(){
        $.ajax({
            dataType:'json',
            url: "{:url('admin/do_user')}",
            success: function(e){
                var str='';
                if (e.code==200){
                    $(e.date).each(function (k,v) {
                        str+='<tr>';
                        str+=' <td>'+v.id+'</td>';
                        str+=' <td>'+v.username+'</td>';
                        str+='<td><button class="btn btn-danger" delid="'+v.id+'">删除</button></td>';
                        str+='<td><button class="btn btn-info" updateid="'+v.id+'">修改</button></td>';
                        str+='<tr>';
                    });
                    $("#tab").append(str)

                }else{
                    alert(e.msg);
                }
            }
        });
    });
    $(document).on('click',".btn-danger",function () {
        alert(111);
    });
</script>
<script>

</script>